package org.jeecg.modules.demo.safemanage.zyhazardinvestigation.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import io.lettuce.core.dynamic.annotation.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.demo.safemanage.zyhazardinvestigation.entity.ZyHazardInvestigation;
import org.jeecg.modules.demo.safemanage.zyhazardinvestigation.vo.QualityTypeVo;
import org.jeecg.modules.demo.safemanage.zyhazardinvestigation.vo.ZyHazardInvestigationFinishStatusVo;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;

/**
 * @Description: 中阳隐患排查信息
 * @Author: jeecg-boot
 * @Date:   2024-03-20
 * @Version: V1.0
 */
@Repository
public interface ZyHazardInvestigationMapper extends BaseMapper<ZyHazardInvestigation> {

    /**
     * 根据天数获取数据库中符合条件的记录数
     * @param startDate
     * @param endDate
     * @param siteId
     * @return
     */
    List<ZyHazardInvestigationFinishStatusVo> getDailyCorrectionStatusCount(@Param("startDate")String startDate, @Param("endDate")String endDate,@Param("siteId")String siteId);

    /**
     * 计算所有隐患未解决的个数
     */
    @Select("SELECT COUNT(*) FROM zy_hazard_investigation WHERE result IN ('待整改','待复查','不合格') AND create_time <= #{beginDate}  AND site_id = #{siteId}")
    Integer getAllPendingCorrectionByResult(@Param("beginDate")String beginDate,@Param("siteId")String siteId);


    List<ZyHazardInvestigationFinishStatusVo> getWeeklyCorrectionStatusCount(Map<String, Object> params);

    List<ZyHazardInvestigationFinishStatusVo> getMonthlyCorrectionStatusCount(Map<String, Object> params);

    List<Map<String, Object>> getProblemTypecount(String siteId, String startTime, String endTime);
    List<QualityTypeVo> getProblemTypecount1(String siteId, String startTime, String endTime);
}
